<%@page import="com.sq.partner.manager.util.StrUtil"%>
<%@page import="java.sql.Struct,java.net.*"%>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<base href="<%=basePath%>">
<title>协议新增</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<style type="text/css">
.input_text{width:180px;}
.select_1{width:180px;}
#agentType3Table{
	 margin: auto;
}
#agentType4Table{
	 margin: auto;
}
#agentType3Table td{
	border: 1px solid #bbcddb;
	height:15px; 
	line-height:15px;
}
#agentType4Table td{
	border: 1px solid #bbcddb;
	height:15px; 
	line-height:15px;
}
</style>
<script src="js/jquery.validate.js" type="text/javascript" ></script>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>
<script type="text/javascript">
var startP = 1;
//自定义map功能
function Map(){
  this.elements = new Array();
   //获取MAP元素个数
   this.size = function() {
       return this.elements.length;
   };
   //判断MAP是否为空
   this.isEmpty = function() {
       return (this.elements.length < 1);
   };
   //删除MAP所有元素
   this.clear = function() {
       this.elements = new Array();
   };
   //向MAP中增加元素（key, value)
   this.put = function(_key, _value) {
       if(this.containsKey(_key)){
        this.remove(_key);
        this.elements.push( {
           key : _key,
           value : _value
        });
       }else{
        this.elements.push( {
           key : _key,
           value : _value
        });
       }  
   };
   //删除指定KEY的元素，成功返回True，失败返回False
   this.remove = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   this.elements.splice(i, 1);
                   return true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
   //获取指定KEY的元素值VALUE，失败返回NULL
   this.get = function(_key) {
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   return this.elements[i].value;
               }
           }
       } catch (e) {
           return false;
       }
       return false;
   };
   //判断MAP中是否含有指定KEY的元素
   this.containsKey = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   bln = true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
  //获取map的所有values
  this.values = function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].value);
       }
       return arr;
   };
  //获取map的所有keys
  this.keys= function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].key);
       }
       return arr;
   };
   //获取数组
   this.getArray= function(){
   	var arr = new Array();
   	for (var i = 0; i < this.elements.length; i++) {
           arr.push({
	            key : this.elements[i].key,
	            value : this.elements[i].value
	         });
       }
       return arr;
   };
}
//根据协议编号判断是添加页面还是修改页面
<%
	String proid="";
	if(null != request.getAttribute("protocol_no")){
		proid=request.getAttribute("protocol_no").toString();
		
		System.out.print("================================================"+(StrUtil.isNotEmpty(proid))+proid); 
	}
	if(StrUtil.isNotEmpty(proid)){
%>
	$(document).ready(function(){
		var protocol_no=$("#hideproid").val();
		init(protocol_no);
		$("#sbtn").attr("onclick","").unbind("click").click(function(){  
			checkAndExcute('update');
		});
		
	});
<%}%>
//根据protocol_no加载协议详情
function init(protocol_no){
	$.ajax({
		url:"noCarProtocol/loadByprotocol_no",
		type:'POST',
		async:false,
		data:{protocol_no:protocol_no},
		dataType:'json',
		success:function(data){
			$("#insu_plan_name").val(data.PLAN_CODE+"-"+data.PLAN_NAME);
			$("#protocol_no").val(data.PROTOCOL_NO);
			$("#businessScope option[value='"+data.BUSI_SCOPE+"']").attr("selected",true); 
			$("#ex_dept").val(data.EX_DEPT);
			$("#startDate").val(data.PRTL_START_DATE);
			$("#endDate").val(data.PRTL_END_DATE);
			$("#bbr_type option[value='"+data.BBR_TYPE+"']").attr("selected",true);
			$("#tbr_name").val(data.TBR_NAME);
			$("#tbr_addr").val(data.TBR_ADDR);
			$("#tbr_tel").val(data.TBR_TEL);
			$("#bbr_name").val(data.BBR_NAME);
			$("#bbr_addr").val(data.BBR_ADDR);
			$("#bbr_tel").val(data.BBR_TEL);
			$("#ex_scope option:contains('"+data.EX_SCOPE+"')").attr("selected",true);
			$("#ex_warrprid").val(data.EX_WARRPRID);
			$("#max_mileage").val(data.MAX_MILEAGE);
			$("#vender_warranty_period").val(data.VENDER_WARRANTY_PERIOD);
			$("#vender_warranty_mileage").val(data.VENDER_WARRANTY_MILEAGE);
			$("#vehicle_use_property").val(data.VEHICLE_USE_PROPERTY);
			$("#id_type option[value='"+data.ID_TYPE+"']").attr("selected",true);
			$("#id_no").val(data.ID_NO);
			$("#business_license_no").val(data.BUSINESS_LICENSE_NO);
			$("#market_expense_ratio").val(data.MARKET_EXPENSE_RATIO);
			$("#money_laundering_risk option[value='"+data.MONEY_LAUNDERING_RISK+"']").attr("selected",true);
			$("#channelCodeQD").val(data.CHANNEL_CODE);
			$("#channelType").val(data.CHANNEL_TYPE);
			$("#bsnsType").val(data.NEW_BSNS_TYPE);
			$("#deptCode").val(data.DEPT_CODE);
			$("#empName").val(data.EMP_NO);
			$("#teamName").val(data.TEAM_CODE);
			$("#serviceCode").val(data.SERVICE_CODE);
			$("#agentNo").val(data.AGENT_NO);
			$("#protocolNo").val(data.PROTOCOL_NO1);
			$("#specialArran").val(data.SPECIAL_ARRAN);
			//方案编码
			$('#insu_plan_code_h').val(data.PLAN_CODE);
			//方案名称 
			$('#insu_plan_name_h').val(data.PLAN_NAME);
		}
	});
	
}
//新增点击保存/修改验证
function checkAndExcute(flag){
	var insu_plan_name=$("#insu_plan_name").val();
	if(insu_plan_name.length==0){
		$.message("error", "请选择投保方案");
		$('#insu_plan_name').focus();
		return;
	}
	var businessScope=$("#businessScope").val();
	if(businessScope.length==0){
		$.message("error", "请选择业务范围");
		$('#businessScope').focus();
		return;
	}
	
	var ex_dept=$("#ex_dept").val();
	if(ex_dept.length==0){
		$.message("error", "请填写第三方延保服务机构");
		$('#ex_dept').focus();
		return;
	}
	
	var startDate=$("#startDate").val();
	var endDate=$("#endDate").val();
	if(startDate.length==0){
		$.message("error", "请选择协议开始日期");
		$('#startDate').focus();
		return;
	}
	if(endDate.length==0){
		$.message("error", "请选择协议结束日期");
		$('#endDate').focus();
		return;
	}
	if(null != startDate && "" != startDate){
		var str = "";
		var strReg = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
		if(startDate.match(strReg)==null){
			$.message("error", "您输入的协议开始日期格式不正确，格式为:YYYY-MM-DD");
			return;
		}
		if(endDate.match(strReg)==null){
			$.message("error", "您输入的协议结束日期格式不正确，格式为:YYYY-MM-DD");
			return;
		}
	}
	
	var bbr_type=$("#bbr_type ").val();
	if(bbr_type.length==0){
		$.message("error", "请选择被保人类型");
		$('#bbr_type').focus();
		return;
	}
	
	var tbr_name=$("#tbr_name").val();
	if(tbr_name.length==0){
		$.message("error", "请输入投保人姓名");
		$('#tbr_name').focus();
		return;
	}
	
	var tbr_addr=$("#tbr_addr").val();
	if(tbr_addr.length==0){
		$.message("error", "请输入投保人地址");
		$('#tbr_addr').focus();
		return;
	}
	
	var tbr_tel=$("#tbr_tel").val();
	if(tbr_tel.length==0){
		$.message("error", "请输入投保人电话");
		$('#tbr_tel').focus();
		return;
	}
	//投保人电话号码验证
	var moPhone=/^1\d{10}$/;
	var telPhone=/^0\d{2,3}-?\d{7,8}$/;
	if( !(moPhone.test(tbr_tel) || telPhone.test(tbr_tel))){
		$.message("error", "请输入正确的电话格式");
		$('#tbr_tel').focus();
		return;
	}

	
	var bbr_name=$("#bbr_name").val();
	if(bbr_name.length==0){
		$.message("error", "请输入被保人姓名");
		$('#bbr_name').focus();
		return;
	}
	
	var bbr_addr=$("#bbr_addr").val();
	if(bbr_addr.length==0){
		$.message("error", "请输入被保人地址");
		$('#bbr_addr').focus();
		return;
	}
	
	var bbr_tel=$("#bbr_tel").val();
	if(bbr_tel.length==0){
		$.message("error", "请输入被保人电话");
		$('#bbr_tel').focus();
		return;
	}
	//被保人电话验证
	if( !(moPhone.test(bbr_tel) || telPhone.test(bbr_tel))){
		$.message("error", "请输入正确的电话格式");
		$('#bbr_tel').focus();
		return;
	}
	
	var ex_scope=$("#ex_scope option:selected").text();
	var ex_scope_id=$("#ex_scope").val();
	if(ex_scope_id.length==0){
		$.message("error", "请选择延保保障范围");
		$('#ex_scope').focus();
		return;
	}
	
	var ex_warrprid=$("#ex_warrprid").val();
	if(ex_warrprid.length==0){
		$.message("error", "请输入延保保修期限");
		$('#ex_warrprid').focus();
		return;
	}
	if(ex_warrprid<12){
		$.message("error", "延保保修期限不允许录入小于12个月");
		$('#ex_warrprid').focus();
		return;
	}
	if(isNaN(Number(ex_warrprid))){
		$.message("error", "延保保修期输入的内容必须为数字");
		$('#ex_warrprid').focus();
		return;
	}
	
	var max_mileage=$("#max_mileage").val();
	if(max_mileage.length==0){
		$.message("error", "请输入保修期限-总里程：(质保里程+延保里程)");
		$('#max_mileage').focus();
		return;
	}
	if(max_mileage<80000){
		$.message("error", "保修期限-总里程：(质保里程+延保里程)不允许录入小于80000公里");
		$('#max_mileage').focus();
		return;
	}
	if(isNaN(Number(max_mileage))){
		$.message("error", "保修期限-总里程：(质保里程+延保里程)输入的内容必须为数字");
		$('#max_mileage').focus();
		return;
	}
	
	var vender_warranty_period=$("#vender_warranty_period").val();
	if(vender_warranty_period.length==0){
		$.message("error", "请输入厂家质保期限");
		$('#vender_warranty_period').focus();
		return;
	}
	if(vender_warranty_period<36){
		$.message("error", "厂家质保期限不允许录入小于36个月");
		$('#vender_warranty_period').focus();
		return;
	}
	if(isNaN(Number(vender_warranty_period))){
		$.message("error", "厂家质保期限输入的内容必须为数字");
		$('#vender_warranty_period').focus();
		return;
	}
	
	var vender_warranty_mileage=$("#vender_warranty_mileage").val();
	if(vender_warranty_mileage.length==0){
		$.message("error", "请输入厂家质保里程数");
		$('#vender_warranty_mileage').focus();
		return;
	}
	if(vender_warranty_mileage<60000){
		$.message("error", "厂家质保里程数不允许录入小于60000公里");
		$('#vender_warranty_mileage').focus();
		return;
	}
	if(isNaN(Number(vender_warranty_mileage))){
		$.message("error", "厂家质保里程数输入的内容必须为数字");
		$('#vender_warranty_mileage').focus();
		return;
	}
	
	var vehicle_use_property=$("#vehicle_use_property").val();
	if(vehicle_use_property.length==0){
		$.message("error", "请填写车辆使用性质");
		$('#vehicle_use_property').focus();
		return;
	}
	
	var id_type=$("#id_type").val();
	if(id_type.length==0){
		$.message("error", "请选择证件类型");
		$('#id_type').focus();
		return;
	}
	
	var id_no=$("#id_no").val();
	if(id_no.length==0){
		$.message("error", "请输入有效身份证明号");
		$('#id_no').focus();
		return;
	}
	//如果用户选择身份证时验证身份证号
	if($("#id_type").val() == '464001'){
		var code = $.trim($("#id_no").val());
		var city={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",
				31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北 ",
				43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏 ",
				61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外 "};
	    if(!code || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code)){
	    	$.message("error", "身份证号格式错误");
			$('#id_no').focus();
			return;
	    }else if(!city[code.substr(0,2)]){
		    	$.message("error", "身份证号不合法");
				$('#id_no').focus();
				return;
		}else{
		        //18位身份证需要验证最后一位校验位
		        if(code.length == 18){
		            code = code.split('');
		            //∑(ai×Wi)(mod 11)
		            //加权因子
		            var factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
		            //校验位
		            var parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
		            var sum = 0;
		            var ai = 0;
		            var wi = 0;
		            for (var i = 0; i < 17; i++){
		                ai = code[i];
		                wi = factor[i];
		                sum += ai * wi;
		            }
		            var last = parity[sum % 11];
		            if(parity[sum % 11] != code[17]){
		            	$.message("error", "身份证号不合法");
		    			$('#id_no').focus();
		    			return;
		            }
		        }
		    }
	}
	
	var business_license_no=$("#business_license_no").val();
	if(business_license_no.length==0){
		$.message("error", "请输入经营许可证号");
		$('#business_license_no').focus();
		return;
	}
	
	var market_expense_ratio=$("#market_expense_ratio").val();
	if(market_expense_ratio.length==0){
		$.message("error", "请输入市场费用率");
		$('#market_expense_ratio').focus();
		return;
	}
	
	var money_laundering_risk=$("#money_laundering_risk option:selected").text();
	var money_laundering_risk_id=$("#money_laundering_risk").val();
	if(money_laundering_risk_id.length==0){
		$.message("error", "请选择洗钱风险");
		$('#money_laundering_risk').focus();
		return;
	}
	var insu_plan_code_h=$('#insu_plan_code_h').val();
	var insu_plan_name_h=$('#insu_plan_name_h').val();
	var  deptCode=$('#deptCode').val();
	if(flag=="add"){
		excuteAdd({
			"ex_scope":ex_scope,
			"ex_scope_id":ex_scope_id,
			"planCode":insu_plan_code_h,
			"planName":insu_plan_name_h,
			"businessScope":businessScope,
			"ex_dept":ex_dept,
			"startDate":startDate,
			"endDate":endDate,
			"bbr_type":bbr_type,
			"tbr_name":tbr_name,
			"tbr_addr":tbr_addr,
			"tbr_tel":tbr_tel,
			"bbr_name":bbr_name,
			"bbr_addr":bbr_addr,
			"bbr_tel":bbr_tel,
			"ex_scope":ex_scope,
			"ex_warrprid":ex_warrprid,
			"max_mileage":max_mileage,
			"vender_warranty_period":vender_warranty_period,
			"vender_warranty_mileage":vender_warranty_mileage,
			"vehicle_use_property":vehicle_use_property,
			"id_type":id_type,
			"id_no":id_no,
			"business_license_no":business_license_no,
			"market_expense_ratio":market_expense_ratio,
			"money_laundering_risk":money_laundering_risk,
			"money_laundering_risk_id":money_laundering_risk_id,
			"deptCode":deptCode
		});
	}
	if(flag=="update"){
		var protocol_no=$("#protocol_no").val();
		excuteUpdate({
			"protocol_no":protocol_no,
			"ex_scope":ex_scope,
			"ex_scope_id":ex_scope_id,
			"planCode":insu_plan_code_h,
			"planName":insu_plan_name_h,
			"businessScope":businessScope,
			"ex_dept":ex_dept,
			"startDate":startDate,
			"endDate":endDate,
			"bbr_type":bbr_type,
			"tbr_name":tbr_name,
			"tbr_addr":tbr_addr,
			"tbr_tel":tbr_tel,
			"bbr_name":bbr_name,
			"bbr_addr":bbr_addr,
			"bbr_tel":bbr_tel,
			"ex_scope":ex_scope,
			"ex_warrprid":ex_warrprid,
			"max_mileage":max_mileage,
			"vender_warranty_period":vender_warranty_period,
			"vender_warranty_mileage":vender_warranty_mileage,
			"vehicle_use_property":vehicle_use_property,
			"id_type":id_type,
			"id_no":id_no,
			"business_license_no":business_license_no,
			"market_expense_ratio":market_expense_ratio,
			"money_laundering_risk":money_laundering_risk,
			"money_laundering_risk_id":money_laundering_risk_id,
			"deptCode":deptCode
		})
	}
}
//新增方法
function excuteAdd(param){
	$.openLoading();
	$.ajax({
		url:"noCarProtocol/addProtocolValve",
		type:'post',
		data:param,
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if("success"==data.result && ""!= data.message){
				window.location.href='<%=path%>/noCarProtocol/list';
			}else if("error"==data.result && ""!= data.message){
				$.message("error", data.message);
			}
		}
							
	});
}

//修改方法
function excuteUpdate(param){
	$.openLoading();
	$.ajax({
		url:"noCarProtocol/updateProtocolValve",
		type:'post',
		data:param,
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if("success"==data.result && ""!= data.message){
				window.location.href='<%=path%>/noCarProtocol/list';
			}else if("error"==data.result && ""!= data.message){
				$.message("error", data.message);
			}
		}
							
	});
} 

//统一 关闭  窗口
function closeCurrentDIV(obj){
	$("#"+obj).CloseDiv();
};


//打开方案窗口
function openPlanDiv(pageIndex){
	$('#plan_code').val('');
	$('#plan_name').val('');
	queryInsuPlan(pageIndex);
}
//调用拼接参数的方法，并执行查询
function queryInsuPlan(pageIndex){
	var size = 10;
	var planCode = $('#plan_code').val();
	var planName = $('#plan_name').val();
	queryAllPlan({size:size,current:pageIndex,planCode:planCode,planName:planName});
}
//查询方案
function queryAllPlan(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadInsuPlan", 
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			 startP = partnerPage.current;
			var radioObj ="<input class='input_fxk' name='prodradio' type='radio' value=''>";
			var fieldNames = "plancode,planname";
			var tableContent = creatTable1(fieldNames,partnerPage,radioObj);
			var tableObj = $("#productTable");
			tableObj.find("tbody").remove();
			tableObj.append(tableContent);
			
			var strPage = creatChannelPage(startP,6,partnerPage.maxPage,"15");
			var pageDIV = $("#productPageDIV");
			pageDIV[0].innerHTML="";
			pageDIV.append(strPage);
			
			$("#prodDiv").OpenDiv();

			bindradio();
		}
	});
}
//点击“确定”选择方案
function chooseProd(){
	var selectedProd= $("input[name='prodradio']:checked");
	if(selectedProd.length==0){
		$.message("error", "请选择一个方案");
		return;
	}
	var planCode = selectedProd.parent().parent().children(" td:eq(1)").html();//方案代码
	var planName = selectedProd.parent().parent().children(" td:eq(2)").html();//方案名称
	$('#insu_plan_code_h').val(planCode);
	$('#insu_plan_name_h').val(planName);
	$('#insu_plan_name').val(planCode+"-"+planName);
	$.ajax({
		url:"noCarProtocol/loadGbx", 
		type:'post',
		data:{"planCode":planCode},
		dataType:'json',
		success:function(npl){
		 	$("#channelCodeQD").val(npl.channelCode);
		 	$("#channelType").val(npl.channelType);
		 	$("#bsnsType").val(npl.newBsnsType);
		 	$("#deptCode").val(npl.deptCode);
		 	$("#empName").val(npl.empNo);
		 	$("#teamName").val(npl.teamCode);
		 	$("#serviceCode").val(npl.serviceCode);
		 	$("#agentNo").val(npl.agentNo);
		 	$("#protocolNo").val(npl.protocolNo);
		 	$("#specialArran").val(npl.specialArran);
		}
	});    
	closeCurrentDIV('prodDiv');

}
//点击返回时跳转页面
function goBack(){
	this.location.href="<%=path%>/noCarProtocol/list";
}
</script>
</head>
<body>
<c:if test="${not empty param.protocol_no }">
<input type="hidden" value="<%=request.getAttribute("protocol_no").toString()%>" id="hideproid"> 
	      <div class="current">
           <table class="current_table_1">
              <tbody>
                <tr class="f2">
                  <td>
                    <img src="./images/current_1.jpg">
                  </td>
                  <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                      <span style=" color:#136bab; ">财险产品管理
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>方案配置
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>协议编辑
                      </span>
                  </td>
                  <td><img src="./images/current_3.jpg"></td>
              </tr>
           </tbody>
         </table>
      </div>
</c:if>
<c:if test="${empty param.protocol_no }">
	      <div class="current">
           <table class="current_table_1">
              <tbody>
                <tr class="f2">
                  <td>
                    <img src="./images/current_1.jpg">
                  </td>
                  <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                      <span style=" color:#136bab; ">财险产品管理
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>协议配置
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>协议新增 
                      </span>
                  </td>
                  <td><img src="./images/current_3.jpg"></td>
              </tr>
           </tbody>
         </table>
      </div>
</c:if>
	     
			<form id="inputForm" >
	        <table class="table_05">
	              <tbody>
		              <tr>
			              <c:if test="${not empty param.protocol_no }">
			                  <td colspan="6" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">协议编辑</td>
			              </c:if>
			              <c:if test="${empty param.protocol_no }">
			                  <td colspan="6" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">协议新增</td> 
			              </c:if>
		              </tr>
		    		  <tr>
		                  <td width="10%" style="text-align:right">投保方案：</td>
		                  <td colspan="5">
		                        <input type="hidden" id="insu_plan_code_h" value=""/>
		                  		<input type="hidden" id="insu_plan_name_h" value=""/>
		                  		<c:if test="${empty param.protocol_no }">
		                  			<input name="insu_plan_name" id="insu_plan_name" type="text"  readonly="readonly" style=" background-color: #ccc;" class="input_text"/><span class="red">*</span>
			                  		<input type="button"  class="input_button_2" id="searchINSU_PLAN_NAME" value="请选择" onClick="openPlanDiv(1)"/> 
			              		</c:if>
			              		<c:if test="${not empty param.protocol_no }">
			              			<input name="insu_plan_name" id="insu_plan_name" onmouseover="this.title=this.value" type="text"  readonly="readonly" style=" background-color: #ccc;" class="input_text" />
			              		</c:if>
		                  </td>
		              </tr>
		              <tr>   
		                  <td width="13%" style="text-align:right">延保协议编号：</td>
		                  <td>
		                  	<c:if test="${empty param.protocol_no }">
		                  		<input name="protocol_no" id="protocol_no" readonly="readonly" style=" background-color: #ccc;" type="text"  maxlength="100" class="input_text" ><span class="red">*</span>
		                  	</c:if>
		                  	<c:if test="${not empty param.protocol_no }">
		                  		<input name="protocol_no" id="protocol_no" readonly="readonly" style=" background-color: #ccc;" type="text"  maxlength="100" class="input_text" >
		                  	</c:if>
		                  </td>
		              	  <td width="10%" style="text-align:right">业务范围 ：</td>
		              	  <td>
		              	  	<select id="businessScope" class="select_1 valid" style="visibility: visible;">
		                  		<c:forEach var="businessScope" items="${businessScope }">
		                  		<option value="${businessScope.code }">${businessScope.codeName }</option>
		                  		</c:forEach>
		                  	</select><span class="red">*</span>
		              	  </td>
		              	  <td width="13%" style="text-align:right">第三方延保服务机构：</td>
		              	  <td>
		              	  	<input name="ex_dept" id="ex_dept" type="text" class="input_text" value="车捷保"><span class="red">*</span>
		              	  </td>	
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">协议开始日期：</td>
		                  <td>
		                  	<input id="startDate" onkeydown="false" onclick="showCalendar('startDate','y-mm-dd');" class="input_time" type="text" style="width:180px" />
							<span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">协议结束日期：</td>
		                  <td>
		                    <input id="endDate" onkeydown="false" onclick="showCalendar('endDate','y-mm-dd');" class="input_time" type="text" style="width:180px" />
							<span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">被保人类型：</td>
		                  <td>
							<select id="bbr_type" class="select_1 valid" style="visibility: visible;">
		                  		<option value="">-----请选择-----</option>
		                  		<c:forEach var="bbrType" items="${bbrType }">
		                  		<option value="${bbrType.code }">${bbrType.codeName }</option>
		                  		</c:forEach>
		                  	</select>
		                  	<span class="red">*</span>		                  
		                  </td>
		              </tr>
		              <tr>
		              	  <td width="10%" style="text-align:right">投保人姓名：</td>
		              	  <td>
		                  <input name="tbr_name" id="tbr_name" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">投保人地址：</td>
		                  <td>
		                  <input name="tbr_addr" id="tbr_addr" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">投保人电话：</td>
		                  <td>
		                  <input name="tbr_tel" id="tbr_tel" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">被保人姓名：</td>
		                  <td>
		                  <input name="bbr_name" id="bbr_name" type="text" class="input_text"><span class="red">*</span>
		                  </td> 
		                  <td width="10%" style="text-align:right">被保人地址：</td>
		                  <td>
		                  <input name="bbr_addr" id="bbr_addr" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">被保人电话：</td>
		                  <td>
		                  <input name="bbr_tel" id="bbr_tel" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">延保保障范围：</td>
		                  <td>
							<select id="ex_scope" class="select_1 valid" style="visibility: visible;">
		                  		<option value="">-----请选择-----</option>
								<c:forEach var ="exScope" items="${exScope}">
		                  			<option value="${exScope.code }">${exScope.codeName }</option>
		                  		</c:forEach>
		                  	</select>
		                  	<span class="red">*</span>		                  
		                  </td>
		                  <td width="10%" style="text-align:right">延保保修期限：</td>
		                  <td>
		                  <input name="ex_warrprid" id="ex_warrprid" type="text" class="input_text">月<span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">保修期限-总里程：(质保里程+延保里程)：</td>
		                  <td>
		                  <input name="max_mileage" id="max_mileage" type="text" class="input_text">公里<span class="red">*</span>
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">厂家质保期限：</td>
		                  <td>
		                  <input name="vender_warranty_period" id="vender_warranty_period" type="text" class="input_text">月<span class="red">*</span>
		                  </td>
		                  <td width="11%" style="text-align:right">厂家质保里程数：</td>
		                  <td>
		                  <input name="vender_warranty_mileage" id="vender_warranty_mileage" type="text" class="input_text">公里<span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">车辆使用性质：</td>
		                  <td>
		                  	<input name="vehicle_use_property" id="vehicle_use_property" type="text" class="input_text" value="家用车"><span class="red">*</span>
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">证件类型：</td>
		                  <td>
							<select id="id_type" class="select_1 valid" style="visibility: visible;">
		                  		<option value="">-----请选择-----</option>
		                  		<c:forEach var ="idType" items="${idType}">
		                  			<option value="${idType.code }">${idType.codeName }</option>
		                  		</c:forEach>
		                  	</select>
		                  	<span class="red">*</span>		                  
		                  </td>
		                  <td width="10%" style="text-align:right">有效身份证明号：</td>
		                  <td>
		                  <input name="id_no" id="id_no" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">经营许可证号：</td>
		                  <td>
		                  <input name="business_license_no" id="business_license_no" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">市场费用率：</td>
		                  <td>
		                  <input name="market_expense_ratio" id="market_expense_ratio" type="text" class="input_text"><span class="red">*</span>
		                  </td>
		                  <td width="10%" style="text-align:right">洗钱风险：</td>
		                  <td colspan="3">
							<select id="money_laundering_risk" class="select_1 valid" style="visibility: visible;">
		                  		<c:forEach var="moneyRisk" items="${moneyRisk }">
		                  		<option value="${moneyRisk.code }">${moneyRisk.codeName }</option>
		                  		</c:forEach>
		                  	</select>
		                  	<span class="red">*</span>		                  
		                  </td>
		              </tr>
		              <!--方案带出内容   -->
		              <tr>
		                  <td width="10%" style="text-align:right">归属渠道：</td>
		                  <td>
		                  	<input name="channelCodeQD" id="channelCodeQD" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text" value="">
		                  </td>
		                  <td width="10%" style="text-align:right">渠道类型：</td>
		                  <td>
		                  	<input name="channelType" id="channelType" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text" value="">
		                  </td>
		                  <td width="10%" style="text-align:right">业务来源：</td>
		                  <td>
		                  	<input name="bsnsType" id="bsnsType" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text" value="">
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">机构部门：</td>
		                  <td>
		                  <input name="deptCode" id="deptCode" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text" value="${npl.deptCode}">
		                  </td>
		                  <td width="10%" style="text-align:right">业务员：</td>
		                  <td>
		                  <input name="empName" id="empName" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
		                  </td>
		                  <td width="10%" style="text-align:right">销售团队：</td>
		                  <td>
		                  <input name="teamName" id="teamName" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">服务代码：</td>
		                  <td>
		                  <input name="serviceCode" id="serviceCode" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
		                  </td>
		                  <td width="10%" style="text-align:right">代理人编码：</td>
		                  <td>
		                  <input name="agentNo" id="agentNo" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
		                  </td>
		                  <td width="10%" style="text-align:right">合作协议号：</td>
		                  <td >
		                  <input name="protocolNo" id="protocolNo" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text">
		                  </td>
		              </tr>
		              <tr>
		                  <td width="10%" style="text-align:right">固定特别约定：</td>
		              	  <td colspan="5">
	                  	  <textarea name="specialArran" id="specialArran" cols="" rows="5" readonly="readonly" style=" background-color: #ccc;resize:none;width:96.2%" class="textarea_1" ></textarea>
	                  	  </td>
	              	  </tr>
	           </tbody>   	  
	         </table> 
	         <div align="center">
	             <input class="input_button_3" name="" id="sbtn" type="button" onclick="checkAndExcute('add')" value="保存">&nbsp;&nbsp;
		         <input class="input_button_3" name="" type="button" value="返回" onclick="goBack()">
	         </div>
	         </form>
		<!--选择方案时打开页面   默认隐藏-->
  		  		<div id="prodDiv"  style="display:none;width:80%;">
			<input type="hidden" id="row_num" name="row_num" value="0"/>
				<div class="table_title_div">
					<table class="table_title" style='width:100%;height:20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('prodDiv')"/></td>
						</tr>
					</table>
				</div>
			<table class="table_02" id="addtempletTable" align="center" >
				<tbody>
				<tr>
				<td>
					<table class="search_table">
					<tr height="30px" >
							<td style="border:0px;text-align: right;">投保方案号：</td>
							<td style="border:0px;text-align: left;">
								<input name="txt3"  id="plan_code"  type="text" class="input_text" value="" style="width:120px;">
							</td>
							<td style="border:0px;text-align: right;">
								投保方案名称：
							</td>
							<td style="border:0px;text-align: left;"><input name="txt3" id="plan_name"  type="text" class="input_text" value="" style="width:120px;"></td>
							<td style="border:0px;text-align: left;">
							<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryInsuPlan(1)"/>
						    </td>
					</tr>
				</table>
				</td></tr>
					<tr>
						<td>
							<table id="productTable"  class="content_table_1">
								<thead>
									<tr class="f1">
					                  <th style="width:5%">选择</th>
					                  <th style="width:45%">投保方案号</th>
					                  <th style="width:50%">投保方案名称</th>
					              	</tr>
								</thead>
								<!-- 修改tobody 默认为空 -->
								<tbody>
								</tbody>
							</table>
							<!-- 修改分页编码id 名  默认为空-->
							<div id="productPageDIV" class="page">
							</div>
						</td>
					</tr>
				</tbody>
			</table>
			<div align="center" >
			 <input class="input_button_3" name="" type="button" onclick="chooseProd()" value="确定">&nbsp;&nbsp;
	         <input class="input_button_3" name="" type="button" onclick="closeCurrentDIV('prodDiv')" value="取消">
			</div>
	   </div>
</body>
</html>